<?php

class Zend_View_Helper_Html2Rgb extends Zend_View_Helper_Abstract
{
    public $view;

    public function html2Rgb($color)
    {
        if ($color[0] == '#')
            $color = substr($color, 1);

        if (strlen($color) == 6)
            list($r, $g, $b) = array($color[0].$color[1],$color[2].$color[3],$color[4].$color[5]);
        elseif (strlen($color) == 3)
            list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]);
        else
            return false;

        $r = hexdec($r); $g = hexdec($g); $b = hexdec($b);

        return array($r, $g, $b);
    }

    public function setView(Zend_View_Interface $view)
    {
        $this->view = $view;
    }
}
?>
